{include file="header"}
<div style="padding: 20px;" class="adminmyucms">
<table class="layui-table">
 
  <thead>
    <tr>
      <th>ID</th>
      <th>原文件名</th>
      <th>附件大小</th>
      <th>附件格式</th>
      <th>预览附件</th>
      <th>添加时间</th>
      <th>上传的用户</th>
      <th>操作</th>
    </tr> 
  </thead>
  <tbody>
  	{volist name=":fun_s('file',array(),'id desc','20,false',0)" id="vo"}
    <tr>
      <td>{$vo.id}</td>
      <td>{$vo.name}</td>
      <td>{$vo.size|size}</td>
      <td>{$vo.ext}</td>
      <td><a href="{$vo.savepath}" target="_blank">下载</a></td>
      <td>{$vo.create_time|timeinfo}</td>
      <td>{:fun_sc_p('member', array('userid'=>$vo['uid']), 'username')}</td>
      <td id="admin_set">
      	<button type="button" class="layui-btn layui-btn-sm layui-btn-danger"  member-name="确定要删除这条记录吗" url="{:url("file/delete")}?id={$vo.id}&m=file" lay-submit lay-filter="deletefile" ><i class="layui-icon">&#xe640;</i> 删除</button>
      </td>
    </tr>
    {/volist}
  </tbody>
</table>
<div class="pages">
{:fun_s('file',array(),'id desc','20,false',0)->render()}
<div>
</div>  
<script>
layui.use('form',function(){
  var form = layui.form
  ,jq = layui.jquery;
  //删除
  form.on('submit(deletefile)', function(data){
    var param = data.field;
    var name = jq(this).attr('member-name');
    var url= jq(this).attr('url');
    //弹出提示
    layer.confirm(''+name+'', function(index){
    loading = layer.load(2, {
      shade: [0.2,'#000']
    });
    jq.post(url,param,function(data){
	
      if(data.code == 1){
        layer.close(loading);
        layer.msg(data.msg, {icon: 1, time: 1000}, function(){
         location.reload();
        });
      }else{
        layer.close(loading);
        layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
      }
    });
    return false;
  });
  });
});
</script>
</body>
</html>
{include file="footer"}